// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import Rolling from "./Rolling";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {
    private rollScrs: Rolling[] = null;
    start () {
        let newNode = cc.find('New Node', this.node);
        if(newNode) {
            this.rollScrs = newNode.getComponentsInChildren(Rolling) || [];
        }
       
    }


    callBack() {
        this.scheduleOnce(() => {
          
            this.rollScrs[0] && this.rollScrs[0].initValue(0);
            this.rollScrs[0] && this.rollScrs[0].setParam(0,380);
            this.rollScrs[0] && this.rollScrs[0].rollToValue(6);
            this.rollScrs[1] && this.rollScrs[1].initValue(2);
            this.rollScrs[1] && this.rollScrs[1].setParam(0,380);
            this.rollScrs[1] && this.rollScrs[1].rollToValue(0);

            this.rollScrs[2] && this.rollScrs[2].initValue(0);
            this.rollScrs[2] && this.rollScrs[2].setParam(2,380);
            this.rollScrs[2] && this.rollScrs[2].rollToValue(6);
            this.rollScrs[3] && this.rollScrs[3].initValue(2);
            this.rollScrs[3] && this.rollScrs[3].setParam(2,380);
            this.rollScrs[3] && this.rollScrs[3].rollToValue(0);
        }, 2)
    }
    // update (dt) {}
}
